# 项目：py-advance
# 文件：03字典结果
# 作者：Frank Gong
# 日期：2025/4/10 12:12
# coding:utf-8
import pymysql
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='12345678', db='hotel')
# 游标设置为字典类型
cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)
cursor.execute("select * from emp")
row_1 = cursor.fetchall()
print(row_1)
for person in row_1:
    print("编号：",person['id'])
    print("姓名：", person['nickname'])
    print("电话：", person['phone'])
    print("年龄：", person['age'])
    print("性别：", ord(person['sex']))
    print("岗位：", person['job'])
    print('----------------------------')
conn.commit()
cursor.close()
conn.close()
